import { Cartographic, Cartesian3, Matrix4 } from "cesium";
/**
 * @name 设置3dtileset高度
 * @param {Object} tileset  3dTileset
 * @param {height} height 高度,米
 */
export const setTilesetHeight = (tileset, height) => {
  const { boundingSphere } = tileset;
  const cartographic = Cartographic.fromCartesian(boundingSphere.center);
  const surface = Cartesian3.fromRadians(
    cartographic.longitude,
    cartographic.latitude,
    0.0
  );
  const offset = Cartesian3.fromRadians(
    cartographic.longitude,
    cartographic.latitude,
    height
  );
  const translation = Cartesian3.subtract(offset, surface, new Cartesian3());
  tileset.modelMatrix = Matrix4.fromTranslation(translation);
};
